#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <set>
using namespace std;
class Solution
{
public:
    bool isToeplitzMatrix(vector<vector<int>> &matrix)
    {
        bool flag = true;
        vector<int> slice1, slice2;
        for (int i = 0; flag && i + 1 < matrix.size(); ++i)
        {
            slice1 = matrix[i];
            slice2 = matrix[i + 1];
            slice1.pop_back();
            slice2.erase(slice2.begin());
            flag = slice1 == slice2;
        }
        return flag;
    }
};